package com.tool.btn;

import java.awt.event.MouseEvent;
import java.util.List;

import javax.swing.SwingConstants;

import org.come.Jpanel.SupportListJpanel;

import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;
import org.come.Jpanel.TestPetJpanel;

public class WspSupportBtn extends MoBanBtn {
    //0上 1下 2顶 3底
    private TestPetJpanel jpanels;
    private int x;
    public WspSupportBtn(String iconpath,int type,int x,TestPetJpanel jpanelS) {
        super(iconpath, type);
        // TODO Auto-generated constructor stub
        this.x=x;
        this.jpanels=jpanelS;


    }
    public WspSupportBtn(String iconpath, int type,int x,String text,TestPetJpanel jpanelS) {
        // TODO Auto-generated constructor stub
        super(iconpath, type, UIUtils.COLOR_BTNTEXT);
        this.setText(text);
        this.setFont(UIUtils.TEXT_FONT);
        setVerticalTextPosition(SwingConstants.CENTER);
        setHorizontalTextPosition(SwingConstants.CENTER);
        this.x=x;
        this.jpanels = jpanelS;
    }
    @Override
    public void chooseyes() {
        // TODO Auto-generated method stub

    }

    @Override
    public void chooseno() {
        // TODO Auto-generated method stub

    }

    @Override
    public void nochoose(MouseEvent e) {
        // TODO Auto-generated method stub
        //获取当前选中的位置
        int w= TestPetJpanel.getListpet().getSelectedIndex();
        if (w==-1) {
            return;
        }
        RoleData data=RoleData.getRoleData();
        List<String> list=null;
        //0上 1下 2顶 3底
        if (x==0) {
            list=data.CHelpBb(w, w-1);
        }else if (x==1) {
            list=data.CHelpBb(w, w+1);
        }else if (x==2) {
            list=data.CHelpBb(w, 0);
        }else {
            list=data.CHelpBb(w, 99);
        }
        if (list!=null) {
            jpanels.initS(list);
        }

    }

}
